using System;
using UnityEngine;

namespace Yoozoo.Gameplay.City
{
    public class DisperseFogComponent : MonoBehaviour
    {
        [Range(0,10)]
        public float lifeTime = 3;

        public MeshRenderer disperseRender;
        
        private float currentTime = 0;
        private bool fading = false;
        
        public void BeginFade()
        {
            currentTime = 0;
            fading = true;
        }

        public void Update()
        {
            if (fading)
            {
                currentTime += Time.deltaTime;
                if (currentTime >= lifeTime)
                {
                    GameObject.DestroyImmediate(this.gameObject);
                }
            }
        }
    }
}